﻿namespace RStudio.UIFramwork
{
    /// <summary>
    /// 处理器|当前活跃对象
    /// </summary>
    public class HandlerManageActives : IUIHandler, IUIAcquisition
    {
        public IUIHandler Next { get; set; }
        public bool IsAcquisition { get; private set; }


        public void Handle(UIBase uiBase)
        {
            if (IsAcquisition)
            {
                this.UIModuleAlive.AddActive(uiBase);

            }
            else
            {
                this.UIModuleAlive.RemoveActive(uiBase);
            }

            Next?.Handle(uiBase);
        }




        public UIModuleAlive UIModuleAlive { get; private set; }

        public HandlerManageActives(UIModuleAlive uiModuleAlive, bool isAcquisition)
        {
            this.UIModuleAlive = uiModuleAlive;
            this.IsAcquisition = isAcquisition;

            //this.UIModuleAlive.CurrentActives = new System.Collections.Generic.List<UIBase>();
        }
    }
}
